package hxg.tcptest.dome3;

import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.Scanner;

/**
 * @author HeXiangGuang
 * @create 2021-06-30 12:05
 */
public class TcpClient {
    public static void main(String[] args) throws Exception{
        Socket socket = new Socket("192.168.0.101", 10086);
        OutputStream os = socket.getOutputStream();
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "utf-8"));
        Scanner input = new Scanner(System.in);
        while (true){
            String data = input.nextLine();
            bw.write(data);
            bw.newLine();
            bw.flush();
            if ("886".equals(data) || "byebye".equals(data)){
                break;
            }
        }
        bw.close();
        socket.close();
    }
}
